package com.meituan.catering.management.order.remote.impl;

import com.meituan.catering.management.common.model.api.thrift.UserContextThriftRequest;
import com.meituan.catering.management.common.remote.BaseThriftRemoteService;
import com.meituan.catering.management.order.remote.ProductRemoteService;
import com.meituan.catering.management.order.remote.model.converter.ProductRemoteConverter;
import com.meituan.catering.management.order.remote.model.converter.ShopRemoteConverter;
import com.meituan.catering.management.order.remote.model.response.ProductDetailRemoteResponse;
import com.meituan.catering.management.order.remote.model.response.ShopDetailRemoteResponse;
import com.meituan.catering.management.product.api.thrift.model.response.ProductDetailThriftResponse;
import com.meituan.catering.management.product.api.thrift.service.ProductThriftService;
import com.meituan.catering.management.shop.api.thrift.model.response.ShopDetailThriftResponse;
import com.meituan.catering.management.shop.api.thrift.service.ShopThriftService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 *
 */
@Slf4j
@Service
public class ProductRemoteServiceImpl extends BaseThriftRemoteService implements ProductRemoteService {


    @Override
    public ProductDetailRemoteResponse findById(UserContextThriftRequest request, String id) {
        ProductThriftService productThriftService = super.buildConsoleThriftService(ProductThriftService.class, 9201);
        ProductDetailThriftResponse byId = productThriftService.findById(request, Long.valueOf(id));
        /**
         * 转换
         */
        ProductDetailRemoteResponse productDetailRemoteResponse = ProductRemoteConverter.fromBO(byId);
        return productDetailRemoteResponse;
    }
}
